//
//  AppDelegate.m
//  JZB
//
//  Created by  on 2022/8/29.
//

#import "AppDelegate.h"
#import "JZTabBarViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.user = [[JZBUser bg_findAll:nil] firstObject];
    CGRect frame = [[UIScreen mainScreen] bounds];
    self.window = [[UIWindow alloc] initWithFrame:frame];
    self.window.rootViewController = [[JZTabBarViewController alloc] init];
    [self.window makeKeyAndVisible];
    return YES;
}
//- (void)setUser:(JZBUser *)user{
//    _user = user;
//    if (_user == nil || _user.token == nil || _user.token.length <= 0) {
//        self.window.rootViewController = [[JZNavigationController alloc] initWithRootViewController:[JZBLoginViewController new]];
//    }else{
//        [CCHttp http].header = @{@"Authorization":user.token};
//        self.window.rootViewController = [[JZTabBarViewController alloc] init];
//    }
//}
- (JZBUser *)user{
    if (!_user) {
        JZBUser *user = [[JZBUser bg_findAll:nil] firstObject];
        if (user) {
            _user = user;
        }else{
            _user = [JZBUser new];
        }
    }
    return _user;
}

@end
